package org.dwell.vertx3.demos.core;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.DeploymentOptions;
import io.vertx.core.Launcher;
import io.vertx.core.Vertx;
import io.vertx.core.json.JsonObject;

/**
 * Created by JianGuo on 2016/1/14.
 */
public class ConfigurationVerticle extends AbstractVerticle {
    public static void main(String[] args) {
//        JsonObject config = new JsonObject().put("name", "tim").put("directory", "/blah");
//        DeploymentOptions options = new DeploymentOptions().setConfig(config);
//
//        Vertx vertx = Vertx.vertx();
//        vertx.deployVerticle("org.dwell.vertx3.demos.core.ConfigurationVerticle", options);

        Launcher.executeCommand("vertx run src/main/java/org/dwell/vertx3/demos/core/ConfigurationVerticle.java");

    }

    @Override
    public void start() throws Exception {
        System.out.println("ConfigurationVerticle started!");
        //config配置信息，可以通过这个verticle的上下文环境，调用config().getString()等获取
        String name = config().getString("name");
        System.out.println(name);
    }
}
